﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using WindowsFormsApplication1.BLL;
using Millionaire;

namespace WindowsFormsApplication1
{
    public partial class FrmLuaTuoi : Form
    {
        LuaTuoiBLL luaTuoiBLL;
        public FrmLuaTuoi()
        {
            InitializeComponent();
            luaTuoiBLL = new LuaTuoiBLL();
            LoadDataToGridView();
        }

        private void LoadDataToGridView()
        {
            dataGridView1.DataSource = luaTuoiBLL.GetAll();
        }

        private void btnThem_Click(object sender, EventArgs e)
        {
            string tenLuaTuoi = txtTenLuaTuoi.Text;
            LuaTuoi lt = new LuaTuoi()
            {
                TenLuaTuoi = tenLuaTuoi
            };
            luaTuoiBLL.AddNew(lt);
            LoadDataToGridView();
            txtTenLuaTuoi.Clear();
        }
    }
}
